package com.menhai.personmanagement.services;

import com.menhai.personmanagement.entity.SysOperate;
import com.menhai.personmanagement.entity.co.UserCo;
import com.menhai.personmanagement.entity.vo.SysOperateVo;
import com.menhai.personmanagement.entity.vo.UserVo;
import com.menhai.personmanagement.mapper.SysOperateMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 用户操作 服务类
 * </p>
 *
 * @author shikun
 * @since 2022-01-24
 */
 @Service
public class ISysOperateService{

    @Autowired
    private SysOperateMapper sysOperateMapper;


    public void addInfo(SysOperate sysOperate){
        sysOperateMapper.insert(sysOperate);
    }

    /**
     * @describe 登录人每日操作次数
     * @param sysOperate
     * @Return java.util.List<com.menhai.personmanagement.entity.vo.SysOperateVo>
     * @Date 2022/1/25 13:39
     * @author shikun
     */
    public List<SysOperateVo> selectByCurrUserAll(SysOperate sysOperate) {
        return sysOperateMapper.selectByCurrUserAll(sysOperate);
    }

    /**
     * @describe 首页操作数据
     * @param currUser
     * @Return com.menhai.personmanagement.entity.vo.SysOperateVo
     * @Date 2022/1/25 14:31
     * @author shikun
     */
    public SysOperateVo jobdatadoctorall(String currUser) {

        SysOperateVo sysOperateVo = new SysOperateVo();
        // 登陆人操作总数
        int  all = sysOperateMapper.selectByCurrUser(currUser);
        //本月操作次数
        int moon = sysOperateMapper.selectByCurdateAll(currUser);
        //当周操作次数
        int week = sysOperateMapper.selectByYearueekAll(currUser);
        //今日操作次数
        int today = sysOperateMapper.selectByCurrUserNowAll(currUser);

        sysOperateVo.setAll(String.valueOf(all));
        sysOperateVo.setToday(String.valueOf(today));
        sysOperateVo.setWeek(String.valueOf(week));
        sysOperateVo.setMoon(String.valueOf(moon));

        return sysOperateVo;
    }
}
